package cn.ichiva.game.poker.ddz;

import java.util.Arrays;

/**
 * @Description 牌
 * @auther Chiva 874460517@qq.com
 * @create 2020-01-13 9:12
 */
public enum Card  implements ICard{

    //黑桃
    SPADE_A(SPADE,1),
    SPADE_2(SPADE,2),
    SPADE_3(SPADE,3),
    SPADE_4(SPADE,4),
    SPADE_5(SPADE,5),
    SPADE_6(SPADE,6),
    SPADE_7(SPADE,7),
    SPADE_8(SPADE,8),
    SPADE_9(SPADE,9),
    SPADE_10(SPADE,10),
    SPADE_J(SPADE,11),
    SPADE_Q(SPADE,12),
    SPADE_K(SPADE,13),

    //梅花
    CLUB_A(CLUB,21),
    CLUB_2(CLUB,22),
    CLUB_3(CLUB,23),
    CLUB_4(CLUB,24),
    CLUB_5(CLUB,25),
    CLUB_6(CLUB,26),
    CLUB_7(CLUB,27),
    CLUB_8(CLUB,28),
    CLUB_9(CLUB,29),
    CLUB_10(CLUB,30),
    CLUB_J(CLUB,31),
    CLUB_Q(CLUB,32),
    CLUB_K(CLUB,33),

    //红桃
    HEART_A(HEART,41),
    HEART_2(HEART,42),
    HEART_3(HEART,43),
    HEART_4(HEART,44),
    HEART_5(HEART,45),
    HEART_6(HEART,46),
    HEART_7(HEART,47),
    HEART_8(HEART,48),
    HEART_9(HEART,49),
    HEART_10(HEART,50),
    HEART_J(HEART,51),
    HEART_Q(HEART,52),
    HEART_K(HEART,53),

    //方块
    DIAMOND_A(DIAMOND,61),
    DIAMOND_2(DIAMOND,62),
    DIAMOND_3(DIAMOND,63),
    DIAMOND_4(DIAMOND,64),
    DIAMOND_5(DIAMOND,65),
    DIAMOND_6(DIAMOND,66),
    DIAMOND_7(DIAMOND,67),
    DIAMOND_8(DIAMOND,68),
    DIAMOND_9(DIAMOND,69),
    DIAMOND_10(DIAMOND,70),
    DIAMOND_J(DIAMOND,71),
    DIAMOND_Q(DIAMOND,72),
    DIAMOND_K(DIAMOND,73),

    //大小王
    BLACK_JOKER(NULL,98),
    RED_JOKER(NULL,99),
    ;


    private final int color;    //花色
    private final int num;      //数值
    private final int index;    //点数

    Card(int color,int num ){
        this.color=color;
        this.num=num ;
        this.index = num - color;
    }

    public int getColor() {
        return color;
    }

    public int getNum() {
        return num;
    }

    public int getIndex() {
        return index;
    }

    public static Card[] getAllEnum(){
        try {
            Class<Enum> clazz = (Class<Enum>) Class.forName(Card.class.getName());
            return (Card[])clazz.getEnumConstants();
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        }
    }
}
